package examples;

public class EnumMethodTest {
    public static void main(String[] args) {
        SeasonEnum summer = SeasonEnum.valueOf("SUMMER");
        SeasonEnum[] values = SeasonEnum.values();
        for(int i = 0 ;i<values.length;i++){
            String message="";
            int result = summer.compareTo(values[i]);
            if(result>0){
                message = summer+"在"+values[i]+"之后"+result+"个位置";
            }
            else if(result <0){
                message = summer+"在"+values[i]+"之前"+(-result)+"个位置";
            }else if(result == 0){
                message = summer+"和"+values[i]+"在同一个位置";
            }
            System.out.println(message);
        }


        SeasonEnum[] values1 = SeasonEnum.values();
        for(int i = 0;i<values1.length;i++){
            System.out.println(values1[i]+"在枚举类型中位置索引值"+values1[i].ordinal());
        }
    }
}
